<template>
  <div class="app-container">
    <el-form ref="form" :model="goodInfo" label-width="80px">
      <el-form-item label="商品名称">
        <el-input :model="goodInfo.name"></el-input>
      </el-form-item>
      <el-form-item label="商品价格">
        <el-input :model="goodInfo.price"></el-input>
      </el-form-item>
      <el-form-item label="商品库存">
        <el-input :model="goodInfo.stock"></el-input>
      </el-form-item>
      <el-form-item label="商品图片">
        <div id="pics">
          <img v-for="pic in picArr" :key="pic" :src="pic" alt="">
        </div>
        <uploader></uploader>
      </el-form-item>
      <el-form-item label="商品详情">
        <tinymce :id="tinyInfo.id"></tinymce>
      </el-form-item>
      <el-form-item label="">
        <el-button type="primary" round>提交</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import uploader from '@/components/Uploader'
import tinymce from '@/components/Tinymce'
export default {
  name: 'goodManage',
  data() {
    return {
      goodInfo: {
        name: '',
        // subtitle: '',
        price: '',
        // priceInShop: '',
        // pv: '',
        // goodNum: 0,
        stock: 99998,
        picurl: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2887247440,3338053777&fm=11&gp=0.jpg|https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1529592840692&di=e1545e9c8b1295cb8462f602a1fb8baa&imgtype=0&src=http%3A%2F%2Fimg4.duitang.com%2Fuploads%2Fitem%2F201605%2F07%2F20160507154432_WnKLC.jpeg|https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1529592840692&di=1b0e17ba96e0a098137ed2f52e71a941&imgtype=0&src=http%3A%2F%2Fimg4.duitang.com%2Fuploads%2Fitem%2F201509%2F26%2F20150926191918_A2FuW.thumb.700_0.jpeg'
      },
      picArr: [],
      listLoading: false,
      tinyInfo: {
        id: 'tinyText'
      }
    }
  },
  methods: {
    editGood(good) {},
    receiveNewImg(url) {
    }
  },
  mounted() {
    this.picArr = this.goodInfo.picurl.split('|')
  },
  components: {
    uploader,
    tinymce
  }
}
</script>
<style lang="scss" scoped>
#pics{
  img{
    width: 100px;
    height: 100px;
    margin-right: 10px;
  }
}
</style>
